{{--/**
* Created by PhpStrom
* User: 郭碧云
* Date: 2021/7/28 8:50
* Desc:
*/--}}
@extends("layout.admin")

@section("title")
    试题列表
@endsection

@section("content")
    {{--修改样式--}}
    <link href="{{asset('css/table.css')}}" rel="stylesheet"/>
    {{--<style>
        .tag_show .layui-form-select, .version_show .layui-form-select {
            width: 166% !important;
        }

        .layui-input {
            color: #999999 !important;
        }
    </style>--}}
    <div class="layui-card-body ">
        <form class="layui-form layui-col-space5 layui-input-inline" id="search-form" style="width: 100%;">
            <div class="demoTable">
                <div>
                    <div class="layui-inline">
                        <input class="layui-input" name="exam" id="exam" style="width: 100% !important;"
                               value="{{request('exam')}}" placeholder="请输入试卷名称">
                    </div>

                    <div class="layui-inline">
                        <label class="layui-form-label">查询时间</label>
                        <div class="layui-inline" id="checkTime">
                            <div class="layui-input-inline">
                                <input type="text" autocomplete="off" name="startDate" id="startDate" class="layui-input" placeholder="开始日期">
                            </div>
                            <div class="layui-form-mid">-</div>
                            <div class="layui-input-inline" style="margin-left: -61px;">
                                <input type="text" autocomplete="off" name="endDate" id="endDate" class="layui-input" placeholder="结束日期">
                            </div>
                        </div>
                    </div>

                    <div class="layui-inline layui-show-xs-block">
                        <a class="layui-btn" lay-submit="" lay-filter="sreach"><i class="layui-icon">&#xe615;</i></a>
                    </div>
                </div>
            </div>

        </form>
    </div>
    {{--列表--}}
    <div class="layui-card-body">
        <script type="text/html" id="toolbar">
            {{--添加--}}

            <div class="layui-inline layui-show-xs-block">
                @if(_can("admin.examPaper.create"))
                    <a href="{{ route("admin.examPaper.create") }}"
                       class="layui-btn layui-btn-sm" data-type="auto" id="create"><i class="layui-icon"></i>添加</a>
                @endif
            </div>

        </script>
        <table id="listT" class="layui-table" lay-filter="table-check"
               lay-data="{toolbar: '#toolbar',defaultToolbar:['filter'], limit:  12 }">
            <thead>
            <tr>
                <th lay-data="{type: 'checkbox', fixed: 'left'}"></th>
                <th lay-data="{field:'id',width:80, fixed: 'left', unresize: true, sort: true}">编号</th>
                <th lay-data="{field:'category_id'}">考试科目</th>
                <th lay-data="{field:'exam'}">试卷名称</th>
                <th lay-data="{field:'score'}">试卷分数</th>
                <th lay-data="{field:'pass_mark'}">及格分数</th>
                <th lay-data="{field:'creator'}">组卷人</th>
                <th lay-data="{field:'type'}">组卷方式</th>
                <th lay-data="{field:'time'}">考试时长</th>
                <th lay-data="{field:'mark_type'}">阅卷方式</th>
                <th lay-data="{field:'is_multi'}">复合试卷</th>
                <th lay-data="{field:'created_at',width:200,hide:true}">创建时间</th>
                <th lay-data="{field:'updated_at',width:200,hide:true}">更新时间</th>
                <th lay-data="{field:'op',fixed: 'right', width:150, align:'center'}">操作</th>
            </tr>
            </thead>
            <tbody>
            {{--@foreach ($question["data"] as $q)
                <tr>
                    <td></td>
                    <td>{{ $q['id'] }}</td>
                    <td>{{ $q['category']['name'] }}</td>
                    <td>{{ $q['type']['name'] }}</td>
                    <td><a href="javascript:;"
                           onclick="admin.openLayerShowForm('{{ route("admin.question.show",["id"=>$q["id"]]) }}', '试题详情', '500px', 'auto','show_q_from')">   {!! $q['question'] !!} </a>
                    </td>
                    <td>{{ \App\Facades\Code::name("QUESTION_LEVEL",$q['level']) }}</td>
                    <td>{{ $q['user']['real_name'].'('.$q['user']['name'].')' }}</td>
                    <td>{{ $q['org']['name'] }}</td>
                    <td>{{ empty($q["tag"])?"":$q['tag']['name'] }}</td>
                    <td>{{ $q['version']['version']}}</td>
                    <td>{{ $q['created_at']}}</td>
                    <td>{{ $q['updated_at']}}</td>
                    <td>
                        <a class="layui-btn layui-btn-xs"
                           href="{{route('admin.question.update',['id'=>$q['id']])}}">编辑</a>
                        <a class="layui-btn layui-btn-xs"
                           onclick="admin.tableDataDelete('{{route('admin.question.destroy',['ids'=>$q['id']])}}',this,'是否删除该试题')">删除</a>
                    </td>
                </tr>
            @endforeach--}}
            </tbody>
        </table>
{{--        @include("layout.page")--}}

    </div>
@endsection

@section('script')
    <script src="{{asset('layui/modules/xm-select.js')}}"></script>
    <script src="{{asset('js/tree/select.js')}}"></script>
    <script>
        layui.use(['laydate','form', 'table', 'layer'], function () {
            var table = layui.table,
                form = layui.form,
                laydate = layui.laydate,
                xmSelect = layui.xmSelect;


            //日期范围
            laydate.render({
                elem: '#checkTime'
                //设置开始日期、日期日期的 input 选择器
                //数组格式为 2.6.6 开始新增，之前版本直接配置 true 或任意分割字符即可
                ,range: ['#startDate', '#endDate']
            });
        });
    </script>

    <script src="{{asset('js/layCommon.js')}}"></script>
@endsection
